async function main() {
    const work = parallelWork(doInstagramWork, doFacebookWork, doTwitterWork, doWeiboWork, doZhihuWork, doJianshuWork, doTaobaoWork)
    await work()
}


/**
 * instagram
 **/
// 执行 instagram 工作
async function doInstagramWork() {
    const client = await initInstagramClient()
    await instagramAutoFollow(client)
    await instagramAutoGreeting(client)
    await instagramAutoPost(client)
}

async function instagramAutoFollow(client) {
    console.log("自动关注")
    const uids = await ins.getFollowUids()
    for (let i = 0; i < uids.length; i++) {
        if (i == 5) {
            await scollPage(client)
        }
        const id = uids[i]
        await ins.followBigVTask(client, uid)
    }
}

async function instagramAutoGreeting(client) {
    console.log("自动打招呼")
    const uids = await ins.getFollowUids()
    for (let i = 0; i < uids.length; i++) {
        if (i == 5) {
            await scollPage(client)
        }
        const id = uids[i]
        await instagramGreeting(client, uid)
    }
}

async function instagramGreeting(client, uid) {
    console.log("给指定用户打招呼:" + uid)
    await enterUserInfoPage(client, uid)
    await updateUserInfo(await getUserInfo(client))
    await commentFirstTopic2(client)
    await zanTopic(client)
}


/**
 * twitter
 **/
async function doTwitterWork() {
    const client = await initTwitterClient()
    await twitterAutoFollow(client)
    await twitterAutoGreeting(client)
    await twitterAutoPost(client)
}









function parallelWork(...fns) {
    return async function(...args) {
        const promiseList = fns.map(fn => { return fn(...args)} )
        return await Promise.all(promiseList)
    }
}
